package cn.yunhe.crm.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.yunhe.crm.dao.DatainfoMapper;
import cn.yunhe.crm.entity.Datainfo;

/**
 * Biz业务层
 * 
 * @author 张旭航
 */

@Service("datainfoService")
public class DatainfoService {

	@Autowired
	private DatainfoMapper datainfomapper;

	public void setDatainfomapper(DatainfoMapper datainfomapper) {
		this.datainfomapper = datainfomapper;
	}

	// 新增资料
	public void saveDatainfo(Datainfo datainfo) {
		datainfomapper.saveDatainfo(datainfo);
	}

	// 根据 id 修改资料
	public boolean updateDatainfo(Datainfo datainfo) {
		return datainfomapper.updateDatainfo(datainfo);
	}

	// 根据 id 删除资料
	public boolean deleteDatainfo(Integer id) {
		return datainfomapper.deleteDatainfo(id);
	}

	// 根据 id 查询资料
	public Datainfo getDatainfoById(Integer id) {
		Datainfo getDatainfoById = datainfomapper.getDatainfoById(id);
		return getDatainfoById;
	}

	// 查询全部资料
	public List<Datainfo> findAllDatainfo() {
		return datainfomapper.findAllDatainfo();
	}
public int checkCountBytoday(){
		
		return datainfomapper.checkCountByToday();
	}
	
	public int checkCountTrainByToday(){
		
		return datainfomapper.checkCountTrainByToday();
	}
	
	public int checkCountProductByToday(){
		
		return datainfomapper.checkCountProductByToday();
	}
	public int checkCountFAQByToday(){
		
		return datainfomapper.checkCountFAQByToday();
	}
}
